package com.tiancheng.trade.order.service;

import com.tiancheng.trade.commom.core.exception.BusinessException;
import com.tiancheng.trade.commom.core.data.ApplicationInfo;
import com.tiancheng.trade.order.bo.CouponBO;
import com.tiancheng.trade.order.bo.OrderBO;
import com.tiancheng.trade.order.bo.SubOrderBO;
import com.tiancheng.trade.order.vo.api.VerificationOrderVO;
import com.tiancheng.trade.order.vo.open.order.*;

import java.util.List;

/**
 * @ClassName OpenOrderService
 * @Description 订单服务 service
 * @Author kellen
 * @Date 2024/11/24 16:31
 */
public interface OpenOrderService {

    /**
     * 应用信息
     *
     * @return
     */
    ApplicationInfo getApplicationInfo(String terMo);

    /**
     * 创建订单（主订单、子订单、优惠券）
     *
     * @param orderBO
     * @param subOrderBOS
     * @param couponBOS
     * @return
     * @throws BusinessException
     */
    OpenCreateOrderResVO create(OrderBO orderBO, List<SubOrderBO> subOrderBOS, List<CouponBO> couponBOS) throws BusinessException;

    /**
     * 取消订单
     *
     * @param cancelOrderVO 订单信息
     * @return 0-成功，1-订单已支付-失败，2-其他状态失败
     */
    int cancelOrder(OpenCancelOrderVO cancelOrderVO);

    /**
     * 查询订单信息
     *
     * @param orderId 订单号
     * @return
     */
    OpenQueryOrderInfoResVo queryOrderInfo(OpenQueryOrderInfoReqVO openQueryOrderInfoReqVO);

    /**
     * 初始化收银台
     *
     * @param cashierVO 参数
     * @return
     */
    OpenCashierResVO cashier(OpenCashierVO cashierVO);

    /**
     * 初始化收银台页面
     *
     * @param initCashierVO 参数
     * @return
     */
    OpenInitCashierResVO initCashier(OpenInitCashierVO initCashierVO);

    /**
     * 支付订单
     *
     * @param orderPayVO 订单支付参数
     * @return
     * @throws BusinessException
     */
    OpenOrderPrePayResVO pay(OpenOrderPayVO orderPayVO) throws BusinessException;

    /**
     * 执行退款
     * @param refundVO
     * @return
     */
    OpenRefundCreateResVO refund(OpenRefundVO refundVO);

    /**
     * 子订单核销
     * @param  date 子订单号集合
     * @return
     */
    OpenVerificationResVO verification(VerificationOrderVO date);


}
